package com.annas;

import com.annas.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;

public class AnnosActivity extends Activity implements OnClickListener{
	
	//ARRAYS
	public int[] buttonMap = {
		R.id.button1,
		R.id.button2,
		R.id.button3
			
	};
	
	//INTEGERS
	public int btnId;
	

	
	//ON CREATE
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        //FIND VIEW FOR SPINNERS
        Spinner year = (Spinner)findViewById(R.id.year);
        Spinner day = (Spinner)findViewById(R.id.day);
        Spinner month = (Spinner)findViewById(R.id.month);
        
        //ADD ADAPTER
        ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.Years, android.R.layout.simple_spinner_item);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        
        ArrayAdapter adapter2 = ArrayAdapter.createFromResource(this, R.array.Days, android.R.layout.simple_spinner_item);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        
        ArrayAdapter adapter3 = ArrayAdapter.createFromResource(this, R.array.Months, android.R.layout.simple_spinner_item);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        
        //SET ADAPTER
        year.setAdapter(adapter);
        day.setAdapter(adapter2);
        month.setAdapter(adapter3);
        
        //FIND VIEW FOR BUTTONS
        Button button1 = (Button)findViewById(R.id.button1);
        Button button2 = (Button)findViewById(R.id.button2);
        Button button3 = (Button)findViewById(R.id.button3);
        
        //ON CLICK LISTENER
        button1.setOnClickListener(this); 
        button2.setOnClickListener(this); 
        button3.setOnClickListener(this); 
        
        
    }
    
    //ON CLICK
	public void onClick(View v) {
		btnId = v.getId();
		
		
		for( int i = 0; i < buttonMap.length; i++){
			if(btnId == buttonMap[i]){
				btnId = i;
			}
		}

	}
		
}